<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>待业人员</title>
</head>
<body>

<div class="layui-card">
    <div class="layui-card-header">
        <h2 class="header-title">人员列表</h2>
        <span class="layui-breadcrumb pull-right">
          <a href="#!console">首页</a>
          <a><cite>人员列表</cite></a>
        </span>
    </div>
    <div class="layui-card-body">
        <h3 class="header-title"><span style="font-weight: bolder">条件查询</span>(行业，职业人才搜索)</h3>
        <form class="layui-form toolbar" lay-filter="industry_form">
            <div class="layui-form-item" id="industry-box1">

            </div>
            <div class="layui-form-item" id="industry-box2">

            </div>
<<<<<<< Updated upstream
=======

            <button lay-submit lay-filter="btn-search" type="button" id="btn-search" class="layui-btn icon-btn"><i
                    class="layui-icon">&#xe615;</i>搜索
            </button>

>>>>>>> Stashed changes
        </form>
        <table class="layui-table" id="unemployed-table" lay-filter="talented-table"></table>
    </div>
</div>
<script type="text/html" id="sex">
    {{#  if(d.sex === 0){ }}
    男
    {{#  } }}
    {{#  if(d.sex === 1){ }}
    女
    {{#  } }}
</script>
<script type="text/html" id="i_edit">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
</script>
<script>
    layui.use(['form','formSelects','config','table','admin'],function () {
        let admin = layui.admin,
            config = layui.config,
            table = layui.table,
            formSelects = layui.formSelects;

        table.render({
            id: "#unemployed-table",
            elem: "#unemployed-table",
            url: config.base_server + "api-talented/tunemployed/list",
            where: {
                access_token: config.getToken().access_token,
                enabled: 1
            },
            parseData: function (res) {
                return {
                    "code": res.code,
                    "msg": res.message,
                    "data": res.data.list,
                    "count": res.data.total
                }
            },
            page: true,
            done: function () {
                formSelects.btns(['skin']);
                formSelects.render({
                    height: "40"
                });
                $(".layui-table-body, .layui-table-box, .layui-table-cell").css('overflow', 'visible');
            },
            cols: [[
                {field: 'id', type: "", sort: true, title: '用户编号'},
                {field: 'nickName', title: '用户名'},
                {field: 'phone', title: '电话'},
                {field: 'sex', title: '性别', toolbar: "#sex"},
                {field: 'createTime', title: '注册时间'},
                {
                    title: '所在行业', templet: function (res) {
                        let data = res.industryList;
                        let html = ''
                        for (let i = 0; i < data.length; i++) {
                            if (data[i].pid === 0) {
                                html += "<optgroup label=\"" + data[i].industryName + "\">"
                                for (let j = 0; j < data.length; j++) {
                                    if (data[j].pid === data[i].id) {
                                        html += "<option selected=\"selected\" value=\'" + data[j].id + "\' disabled=\"disabled\">" + data[j].industryName + "</option>"
                                    }
                                }
                                html += "</optgroup>"
                            }
                        }
                        let content = "<select xm-select-skin=\"warm\" name=\"city\" xm-select=\"" + res.id + "\">" + html + "</select>"
                        // console.log(content)
                        return content
                    }
                },
                {fixed: 'right', title: '操作', toolbar: "#i_edit"}
            ]]

        })
        // myJsonAjax("api-talented/tunemployed",'','post',function (result) {
        //
        // })


    })

    function myJsonAjax(url,data,type,callback) {
        let token = JSON.parse(layui.data("easyweb").token).access_token;
        let URL = 'http://127.0.0.1:9200/';
        $.ajax({
            url: URL+url,
            data:JSON.stringify(data),
            beforeSend:function (xhr) {
                xhr.setRequestHeader('Authorization', 'Bearer ' + token);
            },
            type:type,
            dataType:"json",
            contentType:"application/json",
            success:callback
        })
    }
</script>
</body>
</html>